Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Uninstall NHG in some situations #17814

Merged

Conversation

donaldsharp
Copy link
Member

If you have this series of events:

a) Decision to install a NHG is made in zebra, enqueue to DPLANE b) Changes to NHG are made and we remove it in the master pthread
Since this NHG is not marked as installed it is not removed
but the NHG data structure is deleted
c) DPLANE installs the NHG

In the end the NHG stays installed but ZEBRA has lost track of it.

Modify the removal code to check to see if the NHG is queued. There are 2 cases:

a) NHG is kept around for a bit before being deleted. In this case just see that the NHG is Queued and keep it around too.

b) NHG is not kept around and we are just removing it. In this case check to see if it is queued and send another deletion event.

zebra/zebra_nhg.c Outdated Show resolved Hide resolved
If you have this series of events:

a) Decision to install a NHG is made in zebra, enqueue to DPLANE
b) Changes to NHG are made and we remove it in the master pthread
   Since this NHG is not marked as installed it is not removed
   but the NHG data structure is deleted
c) DPLANE installs the NHG

In the end the NHG stays installed but ZEBRA has lost track of it.

Modify the removal code to check to see if the NHG is queued.
There are 2 cases:

a) NHG is kept around for a bit before being deleted.  In this case
just see that the NHG is Queued and keep it around too.

b) NHG is not kept around and we are just removing it.  In this case
check to see if it is queued and send another deletion event.

Signed-off-by: Donald Sharp <[email protected]>
@donaldsharp donaldsharp force-pushed the nhg_removal_in_some_situations branch from ba9c0ef to 4c16694 Compare January 10, 2025 14:50
@raja-rajasekar
Copy link
Contributor

raja-rajasekar commented Jan 13, 2025

As part of this commit, does it make sense to convert https://github.com/FRRouting/frr/blob/master/zebra/zebra_nhg.c#L3437 as a zlog_warn/error?

		nhe = zebra_nhg_lookup_id(id);

		if (!nhe) {
			if (IS_ZEBRA_DEBUG_NHG)
				zlog_debug("%s operation performed on Nexthop ID (%u) in the kernel, that we no longer have in our table",
					   dplane_op2str(op), id);

			return;
		}

@donaldsharp
Copy link
Member Author

I don't see much point what do we expect the operator to do in this case?

@raja-rajasekar
Copy link
Contributor

ci:rerun

* main pthread ).
*/
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) ||
CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
int ret = dplane_nexthop_delete(nhe);

switch (ret) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag 'NEXTHOP_GROUP_QUEUED' at line 3401 may be unnecessary in the delete scenario. Should we remove the behavior of setting this flag to avoid confusion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is no need to put in a special case here for deletion on Queued. Let's keep the code as simple as possible here.

@ton31337 ton31337 merged commit 76ed8f6 into FRRouting:master Jan 17, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants